<?php
/**
 * 
 * @author Paolo Bertuzzo
 *
 */
namespace Catalog\Helper;

use Catalog\Service\StoreService;
use Utilities\Session\SessionFacade;
use Zend\View\Helper\Partial;

class StoreSwitcherHelper extends Partial
{

    /**
     */
    protected $storeService;

    /**
     *
     * @param StoreService $storeService            
     */
    public function __construct(StoreService $storeService)
    {
        $this->storeService = $storeService;
    }

    /**
     * (non-PHPdoc)
     * 
     * @see \Zend\View\Helper\Partial::__invoke()
     */
    public function __invoke($name = NULL, $values = NULL)
    {
        return parent::__invoke('helper/store_switcher', array(
            'stores' => $this->storeService->getStores(),
            'active_store' => $this->getStore()
        ));
    }
    
    /**
     */
    private function getStore()
    {
        $sessionFacade = new SessionFacade();
         
        return $sessionFacade->getStore();
    }
    
}

?>